package fixtures;
import Entity.Customer;
import server.DB;
import server.ServerWindow;
import fit.ActionFixture;

public class InsertingCustomersDetails extends ActionFixture {

	DB db=null;
	Customer cus=null;
	boolean testResult;
	String ResaulStr=null;
	String[] arr;
	ServerWindow sv;
	
	public void startInsert()
	{
		 cus=new Customer();
	}
	
	public void enterCId(String CId)
	{
		cus.setCId(CId);
	}
	 
	public void entercGeograph (String cGeograph)
	{
		cus.setcGeograph(cGeograph);
	}
	public void entercName (String cName)
	{
		cus.setcName(cName);
	}
	
	public void entercPhone (String cPhone)
	{
		cus.setcPhone(cPhone);
	}
	
	public void entercAge (String cAge)
	{
		cus.setAge(cAge);
	}
	
	public void setup(){
		sv.arr[4]="localhost";
		sv.arr[1]="root";
		sv.arr[2]="Braude";
		String[] arr = new String[10];
		arr[1]="customersdb";
		arr[2]=cus.getCId();
		arr[3]=cus.getcName();
		arr[5]=cus.getcGeograph();
		arr[4]=cus.getcPhone();
		arr[6]=cus.getAge();
		db=new DB(arr);
		
		ResaulStr=db.AddCustomer(arr);
		if(ResaulStr.equals("customer Added to database"))
			testResult=true;
		else
			testResult=false;	
	}
	
	public boolean Add_customer()
	{	
		return testResult;
	}
	
	
}

	